package domain;

import java.text.SimpleDateFormat;
import java.util.Date;

public class SslObject {
	private String url;
	private Date expiry;
	private Date lastChecked;

	public SslObject(String url, Date expiry, Date lastChecked) {
		this.url = url;
		this.expiry = expiry;
		this.lastChecked = lastChecked; 
	}

	public String getUrl() {
		return this.url;
	}

	public String getExpiryString() {
		return convertDateToString(expiry);
	}

	public String getLastCheckedString() {
		return convertDateToString(lastChecked);
	}

	public void setExpiry(Date date) {
		this.expiry = date;
	}

	private String convertDateToString(Date date) {
		String date_to_string;
		if (date != null) {
			SimpleDateFormat dateformatyyyyMMdd = new SimpleDateFormat("dd-MM-yyyy HH:mm");
			date_to_string = dateformatyyyyMMdd.format(date);
		} else {
			date_to_string = "No date";
		}
		
		return date_to_string;
	}
}
